package coms.dto;

import Util.Constant;
import java.io.Serializable;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;

public class ConferenceItem implements Serializable {

    private int id;
    private String topic;
    private String description;
    private Date endDate;
    private Date startDate;
    private ConferenceItemType conferenceItemType;
    private Conference conference;
    private List<Publication> publications;

    public List<Publication> getPublications() {
        return publications;
    }

    public void setPublications(List<Publication> publications) {
        this.publications = publications;
    }

    public Conference getConference() {
        return conference;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public void setConference(Conference conference) {
        this.conference = conference;
    }

    public ConferenceItem() {
        publications = new ArrayList<Publication>();
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getTopic() {
        return topic;
    }

    public void setTopic(String topic) {
        this.topic = topic;
    }

    public ConferenceItemType getConferenceItemType() {
        return conferenceItemType;
    }

    public void setConferenceItemType(ConferenceItemType conferenceItemType) {
        this.conferenceItemType = conferenceItemType;
    }

    public Date getEndDate() {
        return endDate;
    }

    public void setEndDate(Date endDate) {
        this.endDate = endDate;
    }

    public Date getStartDate() {
        return startDate;
    }

    public void setStartDate(Date startDate) {
        this.startDate = startDate;
    }

    public String getStartDateStr() {
        DateFormat df = new SimpleDateFormat(Constant.DATETIME_FORMAT);
        return startDate == null ? "" : df.format(startDate);
    }

    public String getEndDateStr() {
        DateFormat df = new SimpleDateFormat(Constant.DATETIME_FORMAT);
        return endDate == null ? "" : df.format(endDate);
    }

    public void setStartDateStr(String startDate) {
        DateFormat df = new SimpleDateFormat(Constant.DATETIME_FORMAT);
        try {
            this.startDate = df.parse(startDate);
        } catch (ParseException ex) {
            Logger.getLogger(ConferenceItem.class.getName()).log(Level.SEVERE, null, ex);
        }

    }

    public void setEndDateStr(String endDate) {
        DateFormat df = new SimpleDateFormat(Constant.DATETIME_FORMAT);
        try {
            this.endDate = df.parse(endDate);
        } catch (ParseException ex) {
            Logger.getLogger(ConferenceItem.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
}